@echo off

set os_str=%1
set boost_version=%2

set JNI_INCLUDE=%java_home%/include

set BOOST_INCLUDE=%boost_home%/Include
set BOOST_TEST_LIB=%boost_home%/Bin-%os_str%/debug/libboost_test_exec_monitor-mgw34-d-%boost_version%.lib

set GS_INCLUDES=-IExamples/PuntaElena/GraphSupport/Hdr -I%BOOST_INCLUDE% -I_Out/Hdr -I%java_home%/include/%os_str% -I%java_home%/include
set TEST_GS_INCLUDES=%GS_INCLUDES% -IExamples/PuntaElena/GraphSupport/Tests

cd ..\..\
mkdir _Out\Obj
mkdir _Out\Obj\GraphSupport
mkdir _Out\Obj\Tests
mkdir _Out\Bin

del *.o /Q

del _Out\Obj\GraphSupport\* /Q
del _Out\Obj\Tests\* /Q
del _Out\Bin\* /Q

python CM\util\execechdir.py "g++ -c @DIR@/*.cpp %GS_INCLUDES%" "Examples/PuntaElena/GraphSupport/Src" "\\" "/"
move *.o _Out\Obj\GraphSupport

g++ -shared -Wl,--add-stdcall-alias _Out\Obj\GraphSupport\*.o -o _Out\Bin\graphsupport.dll

python CM\util\execechdir.py "g++ -c -Dos_windows @DIR@/*.cpp %TEST_GS_INCLUDES%" "Examples/PuntaElena/GraphSupport/Tests" "\\" "/"
move *.o _Out\Obj\Tests

g++ _Out\Obj\Tests\*.o _Out\Obj\GraphSupport\*.o %BOOST_TEST_LIB% -o _Out\Bin\run-graphsupport-tests

rem _Out\Bin\run-graphsupport-tests
